import java.util.Vector;




public class ThreadCommunication {

	private Vector<ReceivedMessage> recMessages = new Vector<ReceivedMessage>();
	private Vector<ResponseMessage> replyMessages = new Vector<ResponseMessage>();
	
	public ThreadCommunication() {
		
	}
	
	public void addReceivedMessage(ReceivedMessage rMsg){
		recMessages.addElement(rMsg);
	}
	
	public void addResponseMessage(ResponseMessage rMsg){
		replyMessages.addElement(rMsg);
	}
	
	public ReceivedMessage getReceivedMessage(){
		ReceivedMessage rMsg = null;
		if (recMessages.size() > 0){
			rMsg = recMessages.elementAt(0);
			recMessages.removeElementAt(0);
		}
		return rMsg;
	}
	public ResponseMessage getResponseMessage(){
		ResponseMessage rMsg = null;
		if (replyMessages.size() > 0){
			rMsg = replyMessages.elementAt(0);
			replyMessages.removeElementAt(0);
		}
		return rMsg;
	}
	
}
